package com.leoman.plz_p.views.homepage;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

import com.leoman.plz_p.R;
import com.leoman.plz_p.constants.Constants;
import com.leoman.plz_p.interfaces.PointIntroduceView;
import com.leoman.plz_p.presenter.PointIntroducePresenter;
import com.leoman.plz_p.weidget.NavBar;

import butterknife.Bind;
import cn.com.corelib.base.BaseActivity;

/**
 * Created by guoh on 2018/9/3.
 */
public class PointIntroduceActivity extends BaseActivity<PointIntroduceView,PointIntroducePresenter>implements PointIntroduceView{


    @Bind(R.id.nav)
    NavBar nav;
    @Bind(R.id.tv_point_content)
    TextView tvPointContent;

    private String courseChapterId;
    private String courseId;
    private String type;

    public static Intent getLaunchIntent(Context context, String courseChapterId, String courseId, String type) {
        Intent intent = new Intent(context, PointIntroduceActivity.class);
        intent.putExtra(Constants.KEY_COURSE_CHAPTER_ID,courseChapterId);
        intent.putExtra(Constants.KEY_COURSE_ID,courseId);
        intent.putExtra(Constants.KEY_TYPE,type);
        return intent;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.ac_point_introduce;
    }

    @Override
    protected void init(Bundle savedInstanceState) {
        nav.setTitle("安全&等级介绍");
        courseChapterId=getIntent().getStringExtra(Constants.KEY_COURSE_CHAPTER_ID);
        courseId=getIntent().getStringExtra(Constants.KEY_COURSE_ID);
        type=getIntent().getStringExtra(Constants.KEY_TYPE);

        getPresenter().getDetail(String.valueOf(courseChapterId),String.valueOf(courseId),String.valueOf(type));

    }

    @Override
    protected PointIntroducePresenter createPresenter() {
        return new PointIntroducePresenter();
    }

    @Override
    public void obtainSuccess(String content) {
        tvPointContent.setText(Html.fromHtml(content));
    }
}
